package com.jshx.sz.gdjt.util;

/**
 * 字符串工具类
 * @author xiangchangan
 * @create 2011-6-13
 */
public class StringUtil {
	public  boolean isChinese(String str) {
		if (null != str && !"".equals(str)) {
			char[] ch = str.toCharArray();
			for (int i = 0; i < ch.length; i++) {
				char c = ch[i];
				if (isChinese(c) == true) {
					return true;
				} else {
					continue;
				}
			}
		}
		return false;
	}

	public  boolean isChinese(char c) {
		Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);
		if (ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS

		|| ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS

		|| ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A

		|| ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION) {
			return true;
		}
		return false;
	}
}
